package com.example.hms.controller;
import com.example.hms.entity.Reserve;
import com.example.hms.service.ReserveService;
import com.example.hms.ulit.Result;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;


@RestController
@RequestMapping("reserve")
public class ReserveController {

    // 注入ReserveService服务，用于处理与预约相关的业务逻辑
    @Resource
    private ReserveService reserveService;

    /**
     * 查询所有预约信息
     *
     * @param reserve 包含查询条件的预约对象
     * @return 包含查询结果的Result对象
     */
    @RequestMapping(value = "selectAllReserve", method = RequestMethod.GET)
    public Result selectAllReserve(Reserve reserve)  {
        return reserveService.selectAllReserve(reserve);
    }

    /**
     * 插入新的预约记录
     *
     * @param reserve 包含要插入信息的预约对象
     * @return 表示插入操作结果的Result对象
     */
    @RequestMapping(value = "insert", method = RequestMethod.GET)
    public Result insert(Reserve reserve)  {
        return reserveService.insert(reserve);
    }

    /**
     * 更新预约信息
     *
     * @param reserve 包含更新后信息的预约对象
     * @return 表示更新操作结果的Result对象
     */
    @RequestMapping(value = "update", method = RequestMethod.GET)
    public Result update(Reserve reserve)  {
        return reserveService.update(reserve);
    }

    /**
     * 取消预约
     *
     * @param reserve 包含取消预约条件的预约对象
     * @return 表示取消操作结果的Result对象
     */
    @RequestMapping(value = "cancelReserve", method = RequestMethod.GET)
    public Result cancelReserve(Reserve reserve)  {
        return reserveService.cancelReserve(reserve);
    }

    /**
     * 废除预约
     *
     * @param reserve 包含废除预约条件的预约对象
     * @return 表示废除操作结果的Result对象
     */
    @RequestMapping(value = "abrogateReserve", method = RequestMethod.GET)
    public Result abrogateReserve(Reserve reserve)  {
        return reserveService.abrogateReserve(reserve);
    }
}

